class Master(object):
    def __init__(self):
        print("Master-__init__->",self)
        self.kongfu = '[古法煎饼果⼦配⽅]'
 
    def make_cake(self):
        print("Master-make_cake->",self)
        print(f'运⽤{self.kongfu}制作煎饼果⼦')
 
 
class School(object):
    def __init__(self):
        self.kongfu = '[⿊⻢煎饼果⼦配⽅]'
 
    def make_cake(self):
        print(f'运⽤{self.kongfu}制作煎饼果⼦')
 
 
class Prentice(School, Master):
    def __init__(self):
        print("Prentice-__init__->",self)
        self.kongfu = '[独创煎饼果⼦配⽅]'
 
    def make_cake(self):
        print("Prentice-make_cake->",self)
        # 如果是先调⽤了⽗类的属性和⽅法，⽗类属性会覆盖⼦类属性，故在调⽤属性前，先调⽤⾃⼰⼦类的初始化
        # self.__init__()  # 此处没有写self,前面有self
        print(f'运⽤{self.kongfu}制作煎饼果⼦')
 
    # 调⽤⽗类⽅法，但是为保证调⽤到的也是⽗类的属性，必须在调⽤⽅法前调⽤⽗类的初始化
    def make_master_cake(self):
        Master.__init__(self)  # 此行代码相当于Master中的属性重置
        self.make_cake()
 
    def make_school_cake(self):
        School.__init__(self)  # 写self，为了能接收对象
        School.make_cake(self)
 
 
daqiu = Prentice()
# daqiu.make_cake()
daqiu.make_master_cake()
print(daqiu)
# daqiu.make_school_cake()
# daqiu.make_cake()
